package cn.hcbycloud.auth.service;

import cn.hcbycloud.auth.bo.ActionBO;
import cn.hcbycloud.auth.mapper.ActionMapper;
import cn.hcbycloud.auth.model.Action;
import cn.hcbycloud.common.core.utils.ObjectUtils;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.AllArgsConstructor;
import org.springframework.stereotype.Service;

/**
 * 行为表
 * @author gaoheng
 * @date 2022-01-21 23:20:30
 */
@Service
@AllArgsConstructor
public class ActionService extends ServiceImpl<ActionMapper, Action> {
    private ActionMapper actionMapper;

    /**
     * 添加行为信息
     * @param actionBo
     * @return
     */
    public void addActionInfo(ActionBO actionBo) {
        Action action = null;
        try {
            action = ObjectUtils.cloneObject(actionBo, Action.class);
        } catch (Exception e) {
            e.printStackTrace();
        }
        action.preInsert();
        actionMapper.insert(action);
    }
}
